﻿--获得签到4项批注及推广需求分类、网络意识分类
create proc [dbo].[proc_CheckInOut_GetPzCategory]
(
	@checkid int
)
as
	declare @customerid nvarchar(50)
	set @customerid = (select customerid from CheckInOut where id=@checkid)
	
	select 
		top 1
		id,
		(select top 1 description from Customer_Subjoin_List where customerid=@customerid and subjoinid=1 order by uptime desc) as OneText,
		(select top 1 description from Customer_Subjoin_List where customerid=@customerid and subjoinid=2 order by uptime desc) as TwoText,
		(select top 1 description from Customer_Subjoin_List where customerid=@customerid and subjoinid=3 order by uptime desc) as TreeText,
		(select top 1 description from Customer_Subjoin_List where customerid=@customerid and subjoinid=4 order by uptime desc) as FourText,
		(select PublicityDemandId from Customer where customerid=@customerid) as PublicityDemandId,
		(select NetworkConsciousnessId from Customer where customerid=@customerid) as NetworkConsciousnessId
	from
		Customer_Subjoin_List csl
	where 
		csl.customerid=@customerid
	order by csl.id desc
